package cn.bdqn.mh.pojo;



import cn.bdqn.mh.vo.ArticleVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "文章,新闻表")
public class Article implements Serializable {
    @ApiModelProperty(value = "新闻编号")
    private Integer id;//新闻编号
    @ApiModelProperty(value = "标题")
    private String title;//标题
    @ApiModelProperty(value = "摘要")
    private String description;//摘要
    @ApiModelProperty(value = "正文")
    private String body;//正文
    @ApiModelProperty(value = "作者")
    private String author;//作者
    @ApiModelProperty(value = "缩略图路径")
    private String smallImg;//缩略图路径
    @ApiModelProperty(value = "创建人")
    private Integer createdBy;//创建人
    @ApiModelProperty(value = "创建时间")
    private Date createDate;//创建时间
    @ApiModelProperty(value = "类别编号")
    private Integer categoryId;//类别编号
    @ApiModelProperty(value = "新闻标志")
    private Integer flag;//新闻标志
    //导航属性
    private Category newsCategory;

    public Article(ArticleVO articleVO){
        this.id=articleVO.getId();
        this.title=articleVO.getTitle();
        this.author=articleVO.getAuthor();
        this.description=articleVO.getDescription();
        this.body=articleVO.getBody();
        this.smallImg=articleVO.getSmallImg();
        this.categoryId=articleVO.getCategoryId();
    }

}
